package kr.co.redbean.store
{
	import flash.display.DisplayObject;
	import flash.display.Loader;
	import flash.events.Event;
	import flash.events.EventDispatcher;
	import flash.events.ProgressEvent;
	
	public class ObjectInfo extends EventDispatcher implements IObjectInfo
	{
		private var _name:String;
		private var _domain:String;
		private var _priority:uint = 0;
		private var _properties:Object;
		private var _objectProxy:DisplayObject;
		private var _isLoaded:Boolean = false;
		private var _onLoading:Boolean = false;
		private var _loaderInfo:Loader;
		
		public function ObjectInfo(name:String, domain:String, priority:uint, properties:XMLList=null)
		{
			_name = name;
			_domain = domain;
			_priority = priority;
			_properties = setProperties(properties);
			trace(_properties);
		}

		static private function setProperties(props:XMLList):Object {
			var rtn:Object = {};
			for each(var p:XML in props) {
				rtn[String(p.@name)] = String(p.@value);
			}
			
			return rtn;
		}
		
		public function preLoadingMotion():void {
			
		}
		
		public function afterLoadingMotion():void {
			
		}
		
		public function get objectProxy():DisplayObject {
			return _objectProxy;
		}
		
		public function set objectProxy(value:DisplayObject):void {
			_objectProxy = value;
		}

		public function get isLoaded():Boolean
		{
			return _isLoaded;
		}

		public function set isLoaded(value:Boolean):void
		{
			_isLoaded = value;
		}

		public function get name():String
		{
			return _name;
		}

		public function get domain():String
		{
			return _domain;
		}

		public function get priority():uint
		{
			return _priority;
		}

		public function get properties():Object
		{
			return _properties;
		}

		public function get loaderInfo():Loader
		{
			return _loaderInfo;
		}

		public function set loaderInfo(value:Loader):void
		{
			_loaderInfo = value;
		}

		public function get onLoading():Boolean
		{
			return _onLoading;
		}

		public function set onLoading(value:Boolean):void
		{
			_onLoading = value;
		}

	}
}